/**
 * SpringTaskTypeFactory.java
 * com.sitech.dmcs.core.factory
 * Function： TODO 
 *
 *   ver  author   date    
 * ──────────────────────────────────
 *   	 geutopia  Jan 6, 2011        
 *
 * Copyright (c) 2011, TNT All Rights Reserved.
*/

package com.sitech.timing.factory;

import com.sitech.context.SpringContext;
import com.sitech.timing.domain.TaskType;
import com.sitech.timing.Task;
import com.sitech.timing.TaskTypeFactory;

/**
 * ClassName:SpringTaskTypeFactory
 * Function: TODO ADD FUNCTION
 * Reason:	 TODO ADD REASON
 *
 * @author   geutopia
 * @version  
 * @since    Ver 1.1
 * @Date	 2011	Jan 6, 2011		10:53:33 AM
 *
 * @see 	 
 */

public class SpringTaskTypeFactory implements TaskTypeFactory
{

	/**
	 * (non-Javadoc)
	 * @see com.sitech.timing.TaskTypeFactory#getTaskByTaskTaskType(com.sitech.timing.domain.TaskType)
	 */
	public Task getTaskByTaskTaskType(TaskType taskType)
	{
		
		if(taskType != null && taskType.getTaskTypeClass() != null && !"".equals(taskType.getTaskTypeClass()))
		{
			try
			{
				return (Task) SpringContext.getBean(taskType.getTaskTypeClass());

			}
			catch (Exception e) 
			{
				e.printStackTrace();
				return null;
			}

		}
		else
		{
			return null;
		}
		
	}

}
